#include <stdio.h>
#include <time.h>

int main() {
    time_t start;
    time(&start);
    int sum = 0;
    for (int i = 0; i < 1000000000; i++) {
        sum += i;
    }
    time_t end;
    time(&end);
    double cost = difftime(end, start);
    printf("结束时间:%s", ctime(&end));
    printf("开始时间:%s", ctime(&start));
    printf("花费%f秒", cost);
}